package w3_c2_queue;
import java.util.LinkedList;
import java.util.Queue;

import javax.print.DocFlavor;

public class LC_225 {

    public static void main(String[] args) {
        MyStack stack = new MyStack();
        stack.push(1);
        stack.push(2);
        System.out.println(stack.top());
        System.out.println(stack.pop());
        System.out.println(stack.empty());
    }
}

class MyStack {
    private Queue<Integer> a;
    public MyStack() {
       a = new LinkedList<>();
    }

    public void push(int x) {
        a.offer(x);
        for (int i = 0; i < a.size() -1; i++)
            a.offer(a.poll());
    }

    public int pop() {
        return  a.poll();
    }

    public int top() {
        return a.peek();
    }

    public boolean empty() {

        return a.isEmpty();
    }
}